package com.guochenglang.www.service;

import com.guochenglang.www.pojo.Base;
import com.guochenglang.www.service.anotate.Affair;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * 知识库相关业务
 *
 * @author 郭程朗
 */
public interface BaseService {
    /**
     * 创建知识库
     *
     * @param newBase 新的知识库对象
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    @Affair
    int createBase(Base newBase) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 修改知识库信息
     *
     * @param set        修改的内容
     * @param conditions 修改的条件
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int changeBase(Base set, Base conditions) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除知识库
     *
     * @param id 知识库的id
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    @Affair
    int deleteBase(Integer id) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 展示知识库
     *
     * @param baseId 知识库id
     * @return 知识库
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    Base getBase(Integer baseId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获取用户创建的知识库
     *
     * @param userId 用户id
     * @return 知识库列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Base> myControlBase(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;


    /**
     * 获得所有公开的知识库
     *
     * @return 公开知识库列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Base> baseSelectPublic() throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 用户加入的知识库
     *
     * @param userId 用户id
     * @return 知识库列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Base> myEnterBase(int userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
